<?php

	/**
    * @framework : My Framework
    *
    * @author: fatangel26@gmail.com - Nguyễn Bảo Trung
    *
    */

	class helper_session
	{
		public function __construct()
        {
            session_start();
        }

        public function set_userdata($data, $val = '')
        {
            if(is_array($data))
            {
                foreach($data as $key => $value):

                    $_SESSION[$key] = $value;

                endforeach;
            }

            if(is_string($data))
            {
                $_SESSION[$data] = $val;
            }
        }

        public function get_userdata($name)
        {
            return ( ! isset($_SESSION[$name])) ? FALSE : $_SESSION[$name];
        }

        public function unset_userdata($data)
        {
            if(is_array($data))
            {
                foreach($data as $key => $value):

                    unset($_SESSION[$key]);

                endforeach;
            }
            else
            {
                unset($_SESSION[$data]);
            }
        }

	}


    /* End of file helper_session.php */
    /* Location: .//D/root/my_framework/helpers/helper_session.php */